#==============================================================================
#            Copyright (c) 2013 Moritz Hader, Marcel Schrder
#            All Rights Reserved.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#==============================================================================


# We need to set the local path to our build directory, so we can find the source-
# files we want to include later. call my-dir is provided by the ndk-build
# tool and references to the build directory.

LOCAL_PATH := $(call my-dir)

# Call the GNU Clear_Vars make-file, that clears all LOCAL_XXXX paths.

include $(CLEAR_VARS)

#Load the allready build libraries of the QCAR-Framework
LOCAL_MODULE := QCAR-default
#LOCAL_SRC_FILES = ../../../../../vuforia-sdk-android-1-5-9/build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
#LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../../vuforia-sdk-android-1-5-9/build/include
LOCAL_SRC_FILES = ../../../../Development/Android/vuforia-sdk-android-1-5-9/build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../Development/Android/vuforia-sdk-android-1-5-9/build/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

# LOCAL_MODULE defines the name of the lib we are about to build. All subsequent
# definitions and includes are packaged in this module (libxxx.so)

LOCAL_MODULE := HeimdallARNative

# TARGET_PLATFORM defines that we want to use JellyBean 4.2 as target platform

TARGET_PLATFORM := android-17

#Tell the build system to include the GLESv2 library (OPENGL_ES 2.0)

LOCAL_LDLIBS := -llog -lGLESv2

#Set some necessary C-Flags
LOCAL_CFLAGS := -DUSE_FILE32API -DGL_GLEXT_PROTOTYPES=1

# List the source-files that are to be compiled. Note that including headers
# is not necessary, as this is done by the build system.
LOCAL_SHARED_LIBRARIES := QCAR-default
LOCAL_SRC_FILES := HeimdallARNative.cpp egl/HeimdallMath.cpp egl/ShaderManagementUnit.cpp egl/VertexManagementUnit.cpp egl/HeimdallGLUtilities.cpp egl/MatrixManagementUnit.cpp engine/HeimdallNativeMesh.cpp engine/HeimdallNative3DObject.cpp engine/HeimdallNativeSurface.cpp engine/HeimdallObjectContainer.cpp 

# Android will by default build the programm with 16bit instructions (thumb mode).
# Here, we want the programm to make use of the arm-architecture and use 32bit.

LOCAL_ARM_MODE := arm

# Tell the build-system to build the library using the Local_xxx variables defined before.

include $(BUILD_SHARED_LIBRARY)
